fix printing of numbers
authorMatthias Clasen <mclasen@redhat.com>
Wed, 23 Dec 2015 02:58:31 +0000 (21:58 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 23 Dec 2015 03:29:22 +0000 (22:29 -0500)
We should be printing infinite, not inf.

gtk/gtkcssnumbervalue.c

index 927e9bfce9db1560069f7daa47a1b571101e9322..5db0758535d718e23a1040cacdb0858b8a4cf25a 100644 (file)
@@ -17,6 +17,8 @@
 
 #include "config.h"
 
+#include <math.h>
+
 #include "gtkcssnumbervalueprivate.h"
 
 #include "gtkcssenumvalueprivate.h"
@@ -201,10 +203,15 @@ gtk_css_value_number_print (const GtkCssValue *number,
     /* [GTK_CSS_MS] = */ "ms",
   };
 
-  g_ascii_dtostr (buf, sizeof (buf), number->value);
-  g_string_append (string, buf);
-  if (number->value != 0.0)
-    g_string_append (string, names[number->unit]);
+  if (isinf (number->value))
+    g_string_append (string, "infinite");
+  else
+    {
+      g_ascii_dtostr (buf, sizeof (buf), number->value);
+      g_string_append (string, buf);
+      if (number->value != 0.0)
+        g_string_append (string, names[number->unit]);
+    }
 }
 
 static const GtkCssValueClass GTK_CSS_VALUE_NUMBER = {